import QtQuick
import QtQuick3D
import "../Room"

import Utils as Utils
Room{
    id:root
    property BaseBuilder roomBuilder:builderLoader.item
    property int roomType
    property int seed

    Component.onCompleted: {
        sceneData.requestRebuild()
    }

    Binding{
        target:roomBuilder
        value:seed
        property:"seed"
    }

    Binding{
        target:roomBuilder
        value:root
        property:"target"
    }

    Component{
        id:startComp
        StartBuilder{
            target: root
        }
    }

    Component{
        id:endComp
        EndBuilder{
            target: root
        }
    }

    Component{
        id:normalComp
        NormalBuilder{
            target: root
        }
    }

    Loader3D{
        id:builderLoader
        sourceComponent: {
            if(roomType === Utils.Room.Start)
            {
                return startComp
            }
            else if(roomType === Utils.Room.End)
            {
                return endComp
            }
            else if(roomType === Utils.Room.Normal)
            {
                return normalComp
            }
            return null
        }
    }


}
